package com.oneby.Controller;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("v1/users")
public class UserController {

    @GetMapping("/{id}")
    public User get(@PathVariable("id") Integer id, @RequestParam("name") String name) {
        return new User(id, name);
    }

    @PostMapping("/save")
    public String post(@RequestBody String requestBody) {
        return requestBody;
    }

    @Data
    @AllArgsConstructor
    public class User {
        private Integer id;
        private String name;
    }

}
